# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=trevorspray
pkgver=2.3.0
_pyver=3.13
pkgrel=8
epoch=1
pkgdesc='A modular password sprayer with threading, clever proxying, loot modules, and more!'
arch=('any')
groups=('blackarch' 'blackarch-cracker')
url='https://github.com/blacklanternsecurity/TREVORspray'
license=('GPL3')
depends=('trevorproxy' 'python-pysocks' 'python-tldextract' 'python-pygments'
         'python-beautifulsoup4' 'python-exchangelib' 'python-exchangelib'
         'python-mechanicalsoup')
makedepends=('python-build' 'python-pip')
source=("https://files.pythonhosted.org/packages/source/${pkgname::1}/$pkgname/$pkgname-$pkgver.tar.gz"
        'cli.py.patch')
sha512sums=('8984e2a582af9b53d841f7fe015efd7777d2312e1a9a5de36438c36ed2337ef9d2e4ff1de104b92833dec1fbdc728cf6bba6a711797252d07fa2633ceaf31672'
            '83f1c859a4242c9ad1ef85e6031c6dd5946d9c8c094b80e00b94f140f7871c553b41b83db76e6d068eff4b044834f34581175d2b8e2270f7398162fad82a4900')

prepare() {
  cd "$pkgname-$pkgver"

  patch -p2 < "$srcdir/cli.py.patch"
}

build() {
  cd "$pkgname-$pkgver"

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd "$pkgname-$pkgver"

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    "$pkgname"

  touch "$pkgdir/usr/lib/python$_pyver/site-packages/$pkgname/lib/__init__.py"
}

